package Controller;

import Model.Grid;
import Views.CircleView;
import Views.RectangleView;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;

/**
 *
 * @author KOK Leng-Steven & RIEU Simon
 */
public class MouseController extends Controller implements MouseListener
{
   
    public MouseController(Grid model, CircleView circleView, RectangleView rectangleView)
    {
        super(model,circleView,rectangleView);
    }
    
    @Override
    public void mouseClicked(MouseEvent me)
    {
            if (isMoveAuthorized(me.getX() / 20, me.getY() / 20)) 
            {   
                this.model.moveAvatar(me.getX() / 20, me.getY() / 20);
            }
    }

    @Override
    public void mousePressed(MouseEvent me)
    {
        
    }

    @Override
    public void mouseReleased(MouseEvent me)
    {
              
    }

    @Override
    public void mouseEntered(MouseEvent me)
    {
       this.circleView.requestFocus();
       this.rectangleView.requestFocus();
    }

    @Override
    public void mouseExited(MouseEvent me)
    {
                
    }
}
